//
//  ZHX_AVPlayer.m
//  FitTime
//
//  Created by dllo on 16/4/6.
//  Copyright © 2016年 赵建平. All rights reserved.
//

#import "ZHX_AVPlayer.h"

@implementation ZHX_AVPlayer

//单例
+(instancetype)shareAVPlayer {
    
    static ZHX_AVPlayer *player = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        player = [[ZHX_AVPlayer alloc] init];
    });
    return player;
}

- (void)playWithUrl:(NSString *)url {
    
    if (self.currentItem) {
        
        [self replaceCurrentItemWithPlayerItem:self.currentItem];
    }
    
    AVPlayerItem *playerItem = [[AVPlayerItem alloc] initWithURL:[NSURL URLWithString:url]];
    [self replaceCurrentItemWithPlayerItem:playerItem];

}





@end
